namespace devtm.Emit
{
    using System;
    

    [Serializable]
    public class AttachEventStatement : Statement
    {
        private EventReferenceExpression eventRef;
        private Expression listener;

        public AttachEventStatement()
        {
        }

        public AttachEventStatement(EventReferenceExpression eventRef, Expression listener)
        {
            this.eventRef = eventRef;
            this.listener = listener;
        }

        public AttachEventStatement(Expression targetObject, string eventName, Expression listener)
        {
            this.eventRef = new EventReferenceExpression(targetObject, eventName);
            this.listener = listener;
        }

        public EventReferenceExpression Event
        {
            get
            {
                if (this.eventRef == null)
                {
                    return new EventReferenceExpression();
                }
                return this.eventRef;
            }
            set
            {
                this.eventRef = value;
            }
        }

        public Expression Listener
        {
            get
            {
                return this.listener;
            }
            set
            {
                this.listener = value;
            }
        }

        public override object Visit(Object parent, object builder)
        {
            throw new NotImplementedException();
        }
    }
}
